import { Body, Controller, Get, Param, Post } from "@nestjs/common";
import { LoginService } from "../service/login.service";
import { LoginDto } from "../dto/login.dto";
import { jsonBaseResponse } from "../utils/response/response";

@Controller("/api/auth")
export class LoginController{

  constructor(
    private readonly loginService: LoginService,
  ) {}
  @Post("login")
  async login(@Body() loginDto:LoginDto){
    return jsonBaseResponse(await this.loginService.login(loginDto))
  }


  @Post("getPhoneNumber/:phoneCode")
  async getPhoneNumber(@Param() param: string){
    return jsonBaseResponse(await this.loginService.getPhoneNumber(param['phoneCode']))
  }


  @Get("/test")
  async test(){
    return "123123"
  }
}
